import QtQuick 2.0
import QtQuick.Layouts 1.0

Item {
    property real textSize: 30
    property string funcText: qsTr("VF限制值V5:")
    width: func.width+value.width+10
    height: func.height
    property alias valueText: value.text
    property alias tipText: tiptext.text

    Text {
        id:func
        color: "#44F6F6"
        text: funcText
        font.bold: true
        anchors.verticalCenter: parent.verticalCenter
        font.family: "Tahoma"
        font.pixelSize: parent.textSize
        Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
    }

    TextInput {
        id:value
        color: "#eeeeee"
        validator: RegExpValidator{regExp:/^(-?[0-9]+)(\.?[0-9]+)$/}
        text: "???"
        anchors.right: parent.right
        font.bold: true
        selectByMouse: true
        selectionColor: "#7dd8cf"
        anchors.verticalCenter: func.verticalCenter
        font.family: "Tahoma"
        font.pixelSize: parent.textSize
        onFocusChanged: {
            if(focus){
                tiprect.visible = true
                timer.start()
            }
            else tiprect.visible = false
        }
    }
    Timer{
        id:timer
        interval: 5000
        repeat: false
        triggeredOnStart: false
        running: false
        onTriggered: {
            tiprect.visible = false
        }
    }

    Rectangle{
        id:tiprect
        anchors.bottom: parent.top
        anchors.right: parent.right
        width: tiptext.width
        height: tiptext.height
        visible: false
        color: "#889ae1e1"
        Text {
            id:tiptext
            text: "~"
            color: "#eeeeee"
            font.pixelSize: textSize*0.75
        }
    }
}


